home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK2.toast / Development Kits (Disc 2) / QuickTake Digital Camera / QuickTake⁄Windows SDK / QTAKE-D.H next >
Encoding:
C/C++ Source or Header  |  1995-03-14  |  21.1 KB  |  339 lines  |  [TEXT/mdos]

  1. /*******************************************************************************
  2.  * QTAKE-D.H version 2.0
  3.  *
  4.  * Copyright Apple Computer, Inc. 1993 -1995, All Rights Reserved.
  5.  * Portions (c) 1994, 1995 Eastman Kodak Company.
  6.  *******************************************************************************/
  7.  
  8. #ifndef _INC_QTAKE_D
  9. #define _INC_QTAKE_D
  10.  
  11. #define FarPointer far*
  12.  
  13. /* Windows must be this version or later in order for
  14.  * us to be able to support asynchronous operations.
  15.  */
  16. #define WINVER_AS_MAJOR       3
  17. #define WINVER_AS_MINOR       1
  18.  
  19. /* The manufacturerID field of CmPortInfo must be the following.
  20.  * Otherwise Connect will refuse with kCmBadArgError.
  21.  */
  22. #define kCmManufacturerID100    0x0101    // For Venus
  23. #define kCmManufacturerID150    0x00c8    // For Nimbus
  24.  
  25. /* These types must be defined for the user application as well.
  26.  */
  27. typedef short OSErr;                 /* Type of data item all Cm functions return. Follows Mac convention */
  28. typedef unsigned short CameraData;   /* First argument to all the Cm functions. Must be application instance handle.
  29.                                       * WARNING: Should probably say HANDLE instead of u_short. Might lose portability this way */
  30. typedef unsigned short far* CameraDataPtr;
  31.  
  32.                                  /* These must be here so the original structure definitions looks AOK */
  33. typedef unsigned char far*       Handle;   
  34. typedef unsigned char far* StringHandle;
  35. typedef int                     Boolean;
  36. typedef unsigned char far*    BufferPtr;
  37. typedef short far*             shortPtr;
  38. typedef long far*               LongPtr;
  39.  
  40. /* The global constants.
  41.  */
  42. #define kCmMAXPICTNO       4096  /* Max number of pictures a QuickTake camera can store */
  43. #define kCmMAXIDWIDTH        32  /* Number of bytes for camera owner name */
  44.  
  45.                                  /* Picture modes, i.e., image sizes. See CmSetPictureMode */
  46. #define kCmHiRes             16
  47. #define kCmLoRes             32
  48.  
  49.                                  /* Flash modes of the camera. Used in subsequent picture taking */
  50. #define kCmFlashAuto          0  /* Camera decides whether to use flash */
  51. #define kCmFlashOff           1  /* Camera does not use flash */
  52. #define kCmFlashOn            2  /* Camera always uses flash */
  53.  
  54.                                  /* Size of a Decompression Table. See CmGetDecompTable */
  55.  
  56. #define kCmDecompTableSize100 98
  57. #define    kCmDecompTableSize150 174 // This size is for Nimbus Camera
  58.  
  59. #define    kProductID100i        0x0101    // Intel memory in Venus
  60. #define    kProductID100t        0x0100    // Toshiba memory in Venus
  61. #define    kProductID150        0x0001    // For Nimbus
  62.  
  63.                                  /* Constants defined for CmSetSleep.
  64.                   * IT'S IMPORTANT VALUES BE SANDWICHED BETWEEN kCmSleepNow and kCmSleepNever */
  65. #define kCmSleepNow           0  /* Camera hibernates immediately */
  66. #define kCmSleep5M            1  /* Camera hibernates after  5 minutes if no command from host. Default */
  67. #define kCmSleep15M           2  /* Camera hibernates after 15 minutes if no command from host */
  68. #define kCmSleep30M           3  /* Camera hibernates after 30 minutes if no command from host */
  69. #define kCmSleep60M           4  /* Camera hibernates after 60 minutes if no command from host */
  70. #define kCmSleepNever         5  /* Tells Camera never to sleep */
  71.  
  72.                                  /* Constants defined for the batteryStatus member of CmCameraInfo */
  73. #define kPowerAdapter       140  /* Power adapter is being used if >= this value */
  74. #define kBatteryIconFull     86  /* Battery can be said to be full if >= this value */
  75. #define kBatteryIconHalf     80  /* Battery should be said to be half full if below IconFUll and >= this value */
  76. #define kBatteryRangeFull    95  /* Battery full */
  77. #define kBatteryRangeEmpty   75  /* Battery empty */
  78.  
  79. /* The error values returned by the Cm functions.
  80.  */
  81. #define noErr                      0  /* Everything's AOK */
  82. #define kCmAlreadyOpenError        1  /* Library already open */
  83. #define kCmNotOpenError            2  /* Library not open yet */
  84. #define kCmBadArgError             3  /* One of the argument is, points to or contains a pointer to, an illegal value */
  85. #define kCmNotConnectedError       4  /* Application does not have connection to camera */
  86. #define kCmCurrentlyConnectedError 5  /* Application is already connected to an instance of camera */
  87. #define kCmNoMemoryError           6  /* Failed to get memory */
  88. #define kCmNoSuchPortError         7  /* No port corresponding to the given index */
  89. #define kCmCameraError             8  /* Error detected by the camera in context */
  90. #define kCmAIPError                9  /* An asynchronous operation is already in progress */
  91. #define kCmANIPError              10  /* No asynchronous operation outstanding */
  92. #define kCmCommError              11  /* Communication error */
  93. #define kCmCameraNotFoundError    12  /* Device connected to the port is not QuickTake. CmGetPortInfo or CmConnect */
  94. #define kCmHandshakeError         13  /* All baud rate negotiation failed. CmConnect */
  95. #define kCmProtocolError          14  /* Protocol error with QuickTake. All core functions */
  96. #define kCmSystemError            15  /* Windows system error */
  97. #define kCmANSError               16  /* This version of DLL does not support asynchronous operations */
  98. #define kCmCantCancel             17  /* Currently outstanding operation cannot be canceled. */
  99.  
  100. /* The error values returned to CmGetErrorInfo after a Cm function reports
  101.  * CmCameraError.
  102.  * Two pieces of error codes are returned to each call of CmGetErrorInfo, 
  103.  * the first short representing the category of the error and the second one representing
  104.  * the detailed information. on the error (I'm not too much enthusiastic about this implementation).
  105.  */
  106.                                        /* The error categories */
  107. #define kCmErNoError               0   /* I've been fine.                                Used also as detail information */
  108. #define kCmErNoBattery             1   /* Warning.                                       Used also as detail information */
  109. #define kCmErMemoryFull            2   /* Warning: host has to free the camera memory.   Used also as detail information */
  110. #define kCmErFlashNotReady         3   /* Warning.                                       Used also as detail information */
  111. #define kCmErImageMemoryDefect     4   /* Image memory error recovered by a spare block. Used also as detail information */
  112. #define kCmErAttention             5   /* Info: command has been aborted */
  113. #define kCmErParityError           6   /* Parity or CRC error detected by the camera.    Used also as detail information */
  114. #define kCmErTimeoutError          7   /* Host timeout. Perceived by the camera.         Used also as detail information */
  115. #define kCmErHardwareError         8   /* Fatal error! */
  116. #define kCmErBadParameter          9   /* Protocol error, Fatal! */
  117. #define kCmErBadPictureNumber     10   /* No such picture */
  118. #define kCmErUnknownError        255   /* Undocumented error inside camera. Fatal! */
  119.  
  120.                                        /* Detail error information under kCmErAttention */
  121. #define kCmErCommandAborted       10   /* Image upload has been aborted by the host */
  122.  
  123.                                        /* Detail error information under kCmErHardwareError */
  124. #define kCmErGeneralHWError       11      /* Unknown hardware error */
  125. #define kCmErCPUError4Bit         12      /* Error detected within the 4-bit Processor */
  126. #define kCmErCPUError8Bit         13      /* Error detected within the 8-bit Processor */
  127. #define kCmErDSPError             14      /* Error detected within the DSP Processor */
  128. #define kCmErFrameMemoryError     15      /* Error inside the frame memory */
  129. #define kCmErTooManyImageMemoryDefects 16 /* No spare image block available at the time of error */
  130. #define kCmErImageMemoryError     17      /* Fatal error in the image memory */
  131.  
  132.                                        /* Detail error information under kCmErBadParameter */
  133. #define kCmErInvalidCmdCode       18   /* Unknown op code received from the host */
  134. #define kCmErInvalidControlCmd    19   /* Unknown control code received from the host */
  135. #define kCmErInvalidCmdData       20   /* Invalid entry in the Command Descriptor Block from the host */
  136. #define kCmErInvalidData          21   /* Invalid field in the parameter field from the host */
  137. #define kCmErNoData               22   /* No more data to send */
  138.  
  139.                                        /* Detail error information under kCmBadPictureNumber */
  140. #define kCmErBadPicNumImage       23   /* No image exists in the camera */
  141. #define kCmErBadPicNumInfo        24   /* No image information exists in the camera */
  142.  
  143. /* Structure definitions.
  144.  */
  145. #ifndef RC_INVOKED
  146. #pragma pack(1)                        /* Make sure structures are aligned on byte boundary. */
  147. #endif /* RC_INVOKED */                /* C++ by default packs classes on word boundary */
  148.                 /* The standard features of the driver retrieved via CmGetStdFeatures.
  149.                  * Came from Mac world but for Windows only version is meaningful. */
  150. typedef struct {
  151.   short          version;                  /* Version this DLL */
  152. } CmStdFeatures, FarPointer CmStdFeaturesPtr;
  153.  
  154.                 /* Structure to identify the camera at the other end of a given communications
  155.          * device.
  156.          * See CmGetPortInfo, CmConnect and CmDisposePortInfo. */
  157. typedef struct {
  158.   Handle         portIcon;    /* Internal use. Don't touch! */
  159.   StringHandle   portName;    /* Operating specific name of the port. The string "COMn" */
  160.   unsigned long  portStatus;  /* Status this port. See below */
  161.   StringHandle   appName;     /* Name of the application using this port if port busy. NULL for Windows */
  162.   unsigned short manufacturerID; /* 0 always */
  163.   unsigned short productID;   /* 0 always */
  164.   Handle         portConfig;  /* Internal use. Don't touch! */
  165.   unsigned long  dataSpeed;   /* Speed at which communication with camera takes place */
  166. } CmPortInfo, FarPointer CmPortInfoPtr, FarPointer FarPointer CmPortInfoHandle, FarPointer FarPointer FarPointer CmPortInfoHandlePtr;
  167.  
  168.                                /* Valid bit values for portStatus field above. */
  169. #define kCmBitPortVENUS      1    /* Port has a QuickTake camera attached */
  170. #define kCmBitPortBusy      2    /* Port is being used by other application */
  171. #define kInUseByGeoPort  (kCmBitPortVENUS|kCmBitPortBusy)
  172.                                /* Port used by another client of CmDriver. Added 10/21/93 */
  173. #define kPortFree         kCmBitPortVENUS
  174.                                /* QuickTake is connected to this port and its idle */
  175.  
  176.                 /* The product information.
  177.          * Retrieved by CmGetProductInfo. */
  178. typedef struct {
  179.   char           vendorName[8];             /* Apple Computer */
  180.   char           productIdentification[16]; /* Apple Digital Camera */
  181.   unsigned char  hardwareVersion[2];        /* 1.01 - byte[1]=01, byte[0]=01 */
  182.   unsigned char  firmwareVersion[2];        /* 1.10 - byte[1]=01, byte[0]=10 */
  183. } CmProductInfo, FarPointer CmProductInfoPtr;
  184.   
  185.                 /* Temporal information:
  186.          * - time that the camera thinks it is (CmGetCameraInfo)
  187.          * - time that a picture was taken (CmGetPictureInfo)
  188.          * - time that hosts tells the camera to think it is (CmSetDateAndTime) */
  189. typedef struct {
  190.   unsigned char  month;    /* 1 through 12 inclusive */
  191.   unsigned char  day;      /* 1 through 31 inclusive */
  192.   unsigned char  year;     /* Last two digits AD */
  193.   unsigned char  hour;     /* 0 through 23 inclusive. Military. */
  194.   unsigned char  minute;   /* 0 through 59 inclusive */
  195.   unsigned char  second;   /* 0 through 59 inclusive */
  196. } CmDateAndTime, FarPointer CmDateAndTimePtr;
  197.  
  198.                 /* Interface parameters with respect to the host computer */
  199. typedef struct {
  200.   unsigned char  transferRate;       /* Baud Rate: 1200 times this value */
  201.   unsigned char  configuration;      /* Parity, Stop bit and word length */
  202.   unsigned char  timeOut;            /* What the camera thinks the houst ought to return within the period. 10 msecs times this value */
  203. } CmInterface, FarPointer CmInterfacePtr;
  204.  
  205.                 /* The camera-wide info. returned via CmGetCameraInfo. */
  206. typedef struct {
  207.   unsigned char  batteryStatus;                /* in % */
  208.   unsigned short noPicturesTaken;
  209.   unsigned short noPictureImageAvailable;
  210.   unsigned short fullImageWidth;               /* in pixels */
  211.   unsigned short fullImageHeight;              /* in pixels */
  212.   unsigned short thumbnailImageWidth;          /* in pixels */
  213.   unsigned short thumbnailImageHeight;         /* in pixels */
  214.   CmDateAndTime  cameraDateAndTime;
  215.   unsigned char  flashMode;                    /* 0 auto, 1 off, 2 on */
  216.   unsigned short exposureTime;                 /* n in 1/n seconds */
  217.   unsigned short FNumber;                      /* 10 (ten) times real F number. One of 28, 30, 35, 40, 49, 63, 90 or 160 */
  218.   unsigned char  pictureMode;                  /* 16 full-size coler, 32 quarter-size color */
  219.   unsigned char  reserved;                     /* Reserved */
  220.   unsigned char     fullImageDatCompMode;         /* 1 ADPCM */
  221.   unsigned char     thumbImageDatCompMode;        /* 3 bit shift (right 4 bits) */
  222.   unsigned long  totalMemorySize;              /* in bytes */
  223.   unsigned long  freeMemorySize;               /* in bytes */
  224.   char           ownerName[32];
  225.   unsigned char  CCDSensorType;
  226.   CmInterface    hostInterface;                /* See above */
  227.   unsigned char  cameraInformationBytes[6];    /* Set at factory. Can't be modified */
  228.   unsigned char  compDecompParamVersion[4];    /* See CmGetDecompTable */
  229.   unsigned char  colorMatrixVersion[4];        /* See CmColorMatrix below */
  230.   unsigned char  spareImageMemoryBlock;        /* # spare image blocks. Max 3 */
  231.   unsigned short noBasePicturesTaken;          /* # Base-size pictures taken */
  232.   unsigned short noQuarterPicturesTaken;       /* # Quater-size pictures taken */
  233.   unsigned char  sleepDelay;                   /* Sleep delay factor, in the range 0 and 5, inclusive */
  234. } CmCameraInfo, FarPointer CmCameraInfoPtr;
  235.   
  236.                 /* The info. used to characterize a picture. Returned via CmGetPictureInfo */
  237. typedef struct  {
  238.   unsigned short pictureNo;
  239.   unsigned long  imageDataSize;
  240.   unsigned short width;
  241.   unsigned short height;
  242.   CmDateAndTime  dateAndTime;
  243.   unsigned char  flashMode;
  244.   unsigned short exposureTime;
  245.   unsigned short FNumber;
  246.   unsigned char  pictureMode;           /* bit0=0 Full Size, bit0=1 1/4 size, bit4=0  B&W, bit4=1 Color */
  247.   unsigned char  dataCompressionMode;   /* CFA=0, ADPCM=1, ColorDiff=2 */
  248.   unsigned char  defectiveFlag;         /* If 1, this picture contains some defective blocks */
  249. } CmPictureInfo, FarPointer CmPictureInfoPtr;
  250.  
  251.                 /* The color matrix pertaining to all pictures taken by a QuickTake 
  252.          * Returned via CmGetColorCorrectionMatrix. */
  253. typedef struct {
  254.   unsigned char  colorMatrixVersion[4];
  255.   double     colorCorrectionMatrix[12];
  256. } CmColorMatrix, FarPointer CmColorMatrixPtr;
  257.  
  258. #ifndef RC_INVOKED
  259. #pragma pack()
  260. #endif  /* RC_INVOKED */
  261.  
  262. /* Cm Functions prototypes and global variables definitions.
  263.  */
  264. /*----------------------------------------------------------------------------------------------*/
  265. typedef void (far pascal* CmAsyncCompletionRoutinePtr) (void);
  266. /*----------------------------------------------------------------------------------------------*/
  267. #ifdef __cplusplus
  268. extern "C" {
  269. #endif /* __cplusplus */
  270. /*----------------------------------------------------------------------------------------------*/
  271.                                            /* Globals related to asynchronous callback routines */
  272. extern OSErr far          gsAsyncStatus;   /* Completion status this asynchronous operation     */
  273. extern unsigned long far gulAsyncNBytes;   /* Number of bytes transferred this async operation  */
  274. /*----------------------------------------------------------------------------------------------*/
  275. extern OSErr far pascal CmCancelAsyncOperation(CameraData);
  276. /*----------------------------------------------------------------------------------------------*/
  277. extern OSErr far pascal CmOpenDriver(CameraDataPtr);
  278. /*----------------------------------------------------------------------------------------------*/
  279. extern OSErr far pascal CmCloseDriver(CameraData);
  280. /*----------------------------------------------------------------------------------------------*/
  281. extern OSErr far pascal CmGetStdFeatures(CameraData,CmStdFeaturesPtr, short length);
  282. /*----------------------------------------------------------------------------------------------*/
  283. extern OSErr far pascal CmGetPortInfo(CameraData,unsigned long, CmPortInfoHandlePtr);
  284. /*----------------------------------------------------------------------------------------------*/
  285. extern OSErr far pascal CmDisposePortInfo(CameraData,CmPortInfoHandle);
  286. /*----------------------------------------------------------------------------------------------*/
  287. extern OSErr far pascal CmConnect(CameraData,CmPortInfoHandle);
  288. /*----------------------------------------------------------------------------------------------*/
  289. extern OSErr far pascal CmDisconnect(CameraData);
  290. /*----------------------------------------------------------------------------------------------*/
  291. extern OSErr far pascal CmCheckIfReady(CameraData);
  292. /*----------------------------------------------------------------------------------------------*/
  293. extern OSErr far pascal CmRestoreDefaults(CameraData);
  294. /*----------------------------------------------------------------------------------------------*/
  295. extern OSErr far pascal CmGetErrorInfo(CameraData,shortPtr,shortPtr);
  296. /*----------------------------------------------------------------------------------------------*/
  297. extern OSErr far pascal CmGetProductInfo(CameraData,CmProductInfoPtr);
  298. /*----------------------------------------------------------------------------------------------*/
  299. extern OSErr far pascal CmTakePicture(CameraData,Boolean);
  300. /*----------------------------------------------------------------------------------------------*/
  301. extern OSErr far pascal CmTakePictureAsync(CameraData,Boolean,CmAsyncCompletionRoutinePtr);
  302. /*----------------------------------------------------------------------------------------------*/
  303. extern OSErr far pascal CmSelfTest(CameraData);
  304. /*----------------------------------------------------------------------------------------------*/
  305. extern OSErr far pascal CmGetCameraInfo(CameraData,CmCameraInfoPtr);
  306. /*----------------------------------------------------------------------------------------------*/
  307. extern OSErr far pascal CmGetPictureInfo(CameraData,unsigned short,CmPictureInfoPtr);
  308. /*----------------------------------------------------------------------------------------------*/
  309. extern OSErr far pascal CmGetThumbnailImage(CameraData,unsigned short,BufferPtr,unsigned long,Boolean,LongPtr);
  310. /*----------------------------------------------------------------------------------------------*/
  311. extern OSErr far pascal CmGetThumbnailImageAsync(CameraData,unsigned short,BufferPtr,unsigned long,Boolean,CmAsyncCompletionRoutinePtr);
  312. /*----------------------------------------------------------------------------------------------*/
  313. extern OSErr far pascal CmGetFullSizeImage(CameraData,unsigned short,BufferPtr,unsigned long,Boolean,LongPtr);
  314. /*----------------------------------------------------------------------------------------------*/
  315. extern OSErr far pascal CmGetFullSizeImageAsync(CameraData,unsigned short,BufferPtr,unsigned long,Boolean,CmAsyncCompletionRoutinePtr);
  316. /*----------------------------------------------------------------------------------------------*/
  317. extern OSErr far pascal CmErase(CameraData);
  318. /*----------------------------------------------------------------------------------------------*/
  319. extern OSErr far pascal CmEraseAsync(CameraData,CmAsyncCompletionRoutinePtr);
  320. /*----------------------------------------------------------------------------------------------*/
  321. extern OSErr far pascal CmSetDateAndTime(CameraData,CmDateAndTimePtr);
  322. /*----------------------------------------------------------------------------------------------*/
  323. extern OSErr far pascal CmSetOwnerName(CameraData,BufferPtr);
  324. /*----------------------------------------------------------------------------------------------*/
  325. extern OSErr far pascal CmSetPictureMode(CameraData,unsigned char);
  326. /*----------------------------------------------------------------------------------------------*/
  327. extern OSErr far pascal CmSetFlashMode(CameraData,unsigned char);
  328. /*----------------------------------------------------------------------------------------------*/
  329. extern OSErr far pascal CmGetDecompTable(CameraData,BufferPtr);
  330. /*----------------------------------------------------------------------------------------------*/
  331. extern OSErr far pascal CmGetColorCorrectionMatrix(CameraData,CmColorMatrixPtr);
  332. /*----------------------------------------------------------------------------------------------*/
  333. extern OSErr far pascal CmSetSleep(CameraData,short sd);
  334. /*----------------------------------------------------------------------------------------------*/
  335. #ifdef __cplusplus
  336. };
  337. #endif /* __cplusplus */
  338. #endif /* _INC_QTAKE_D */
  339.